﻿using System;
using System.Threading.Tasks;
using Thinker.SignChannel.Entities;
using Thinker.SignChannel.Times;
using Volo.Abp.Domain.Repositories;

namespace Thinker.SignChannel.Repositories;

public interface ITimeRepository : IRepository<Time, Guid>
{
    Task<Time?> FindByKeyAsync(DateOnly date, string period, Direction direction)
    {
        return FindAsync(e =>
            e.SignDate == date &&
            e.Period == period &&
            e.Direction == direction);
    }

    Task<Time?> FindByTimeAsync(DateTime time)
    {
        return FindAsync(x => x.SignBegin <= time && x.SignEnd >= time);
    }
}